home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Magazine / SoundLab / Studio16add / sources / S16IsPermanent.asm < prev    next >
Encoding:
Assembly Source File  |  1997-12-10  |  3.8 KB  |  175 lines

  1. *>b:S16IsPermanent
  2.  
  3.     *«««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««*
  4.     *   Copyright © 1997 by Kenneth "Kenny" Nilsen.  E-Mail: kenny@bgnett.no              *
  5.     *   Source viewed in 800x600 with mallx.font (11) in CED                      *
  6.     *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
  7.     *
  8.     *   Name
  9.     *    S16IsPermanent
  10.     *
  11.     *   Function
  12.     *    Check if a Studio 16 file contains edits
  13.     *
  14.     *   Inputs
  15.     *    <file>
  16.     *
  17.     *   Notes
  18.     *    2.0 = total rewrite
  19.     *
  20.     *   Bugs
  21.     *    
  22.     *   Created    : 12.11.97
  23.     *   Changes    : 12.11.97, 13.11.97, 26.11.97
  24.     *««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««*
  25.  
  26.  
  27. ;StartSkip    SET    1
  28. ;DODUMP        SET    1
  29.  
  30.  
  31.         Incdir    inc:
  32.  
  33.         include    lvo/exec_lib.i
  34.         include    lvo/dos_lib.i
  35.  
  36.         include    digital.macs
  37.         include    digital.i
  38.         include    libraries/studio16file.i
  39.  
  40.         include    dos/dos.i
  41.         include    exec/types.i
  42.  
  43.         include    startup.asm
  44.  
  45.         Incdir    ""
  46.  
  47.         dc.b    "$VER: S16IsPermanent 2.0 (26.11.97)",10
  48.         dc.b    "Copyright © 1997 Digital Surface. All rights reserved. ",0
  49.         even
  50. *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
  51. Dump    macro
  52.     move.l    #5,Warn
  53.     move.l    #\1,d1
  54.     bra    Print
  55.     endm
  56.  
  57. Buffer    =    S16S_sizeof
  58. *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
  59. Init        DefLib    dos,37
  60.         DefEnd
  61.  
  62. Start    LibBase    dos
  63.  
  64.     NextArg
  65.     beq    About
  66.     move.l    d0,a0
  67.     cmp.b    #'?',(a0)
  68.     beq    About
  69.  
  70.     lea    IFile(pc),a1
  71. .copy    move.b    (a0)+,(a1)+
  72.     bne.b    .copy
  73.  
  74. ; alloc memory
  75.  
  76.     LibBase    exec
  77.     move.l    #Buffer,d0
  78.     move.l    #$10001,d1
  79.     Call    AllocMem
  80.     move.l    d0,Mem
  81.     beq    ErrorMem
  82.  
  83. *------------------------------------------------------------------------------------------------------------*
  84. ; open file and check it
  85.  
  86.     LibBase    dos
  87.  
  88.     move.l    #IFile,d1
  89.     move.l    #MODE_OLDFILE,d2
  90.     Call    Open
  91.     move.l    d0,IHan
  92.     beq    ErrorOpenI
  93.  
  94.     move.l    d0,d1
  95.     move.l    Mem(pc),d2
  96.     move.l    #S16S_SIZEOF,d3
  97.     Call    Read
  98.     cmp.l    #S16S_SIZEOF,d0
  99.     bne    ErrorRead
  100.  
  101. ; check header
  102.  
  103.     move.l    Mem(pc),a0
  104.     cmp.l    #'KWK3',(a0)
  105.     bne    ErrorType
  106.  
  107. ; equal size ?
  108.  
  109.     move.l    S16S_REALSIZE(a0),d0
  110.     move.l    S16S_EDITSIZE(a0),d1
  111.     cmp.l    d0,d1
  112.     bne    ErrorEdit
  113.  
  114. ; count SampleClips
  115.  
  116.     lea    S16S_EDITLIST(a0),a1    ;Show main clip as well
  117.     moveq    #0,d0            ;SampleClip counter
  118.     moveq    #MAXSAMPLECLIPS-1,d1    ;list tracker counter
  119. .countS    move.l    (a1)+,d2        ;_START
  120.     move.l    (a1)+,d3        ;_END
  121.     beq    .smpEnd
  122.     addq.l    #1,d0            ;we had one, add one to counter
  123.     dbra    d1,.countS
  124.  
  125. .smpEnd    cmp.l    #1,d0
  126.     bne    ErrorEdit
  127.  
  128. *------------------------------------------------------------------------------------------------------------*
  129. Close    LibBase    exec
  130.     move.l    Mem(pc),d0
  131.     beq    .noMem
  132.     move.l    d0,a1
  133.     move.l    #Buffer,d0
  134.     Call    FreeMem
  135.  
  136. .noMem    LibBase    dos
  137.     move.l    IHan(pc),d1
  138.     beq    .noI
  139.     Call    Close
  140.  
  141. .noI    move.l    Warn(pc),d0
  142.     rts
  143. *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
  144. Proc    move.b    d0,(a3)+
  145.     rts
  146.  
  147. ErrorMem    Dump    ErrMem
  148. ErrorOpenI    Dump    ErrOpenI
  149. ErrorRead    Dump    ErrRead
  150. ErrorType    Dump    ErrType
  151. ErrorEdit    Dump    ErrEdit
  152.  
  153. About        move.l    #AboutTxt,d1
  154.         move.l    #10,Warn
  155.  
  156. Print        LibBase    dos
  157.         Call    PutStr
  158.         bra    Close
  159. *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
  160. Warn        dc.l    0
  161. IHan        dc.l    0
  162. Mem        dc.l    0
  163.  
  164. IFile        dcb.b    300,0
  165. *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
  166. ErrMem        dc.b    "Out of memory!",10,0
  167. ErrOpenI    dc.b    "Couldn't open input file!",10,0
  168. ErrRead        dc.b    "Error reading file!",10,0
  169. ErrType        dc.b    "This is not a Studio 16 3.0 file!",10,0
  170. ErrEdit        dc.b    "File contains edits!",10,0
  171.  
  172. AboutTxt    dc.b    10,27,"[1mS16IsPermanent",27,"[0m 2.0 by Kenneth 'Kenny' Nilsen (kenny@bgnett.no)",10,10
  173.         dc.b    "    USAGE: S16IsPermanent <Studio 16 file>",10,10,0
  174. *»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»*
  175.